
Ext.define('markModel',{
	extend:'Ext.data.Model',

	fields:[
	        	{name:'prom',type:'String'},
		        {name:'mark',type:'string'}	,
	        	{name:'teacherId',type:'string'}

		       ]
});

markList = function(){	
	
var markstore = Ext.create('Ext.data.Store',{
	model:markModel,
	autoLoad:true,
	proxy:{
		type:'ajax',
		url:'selectMarkAction.action',
		reader:{
			type:'json',
			root:'markList'
		},
	},
});
Ext.define('inquireData',{
	extend:'Ext.data.Model',
	//id:'sourseDate',
	fields:[
	        	{name:'answerCode',type:'string'},
		        {name:'inquireAnswer',type:'string'},
		        {name:'teacherId',type:'string'},
		        {name:'studentId',type:'string'},
		        {name:'studentName',type:'string'},
		        {name:'prom',type:'string'},
		        {name:'other',type:'string'},
		        {name:'isHidden',type:'string'}
		       ]
});
var inquireStore = Ext.create('Ext.data.Store',{
	//pageSize:8,
	model:inquireData,
	//groupField: 'prom',
	//autoLoad:true,
	proxy:{
		type:'ajax',
		url:'searchInquireForTeacherAction.action',
		reader:{
			type:'json',
			root:'resultList',
			//totalProperty:'resultList.total'
		}
	}
});
var inquireGrid = Ext.create('Ext.grid.Panel',{
	store:inquireStore,	
	columnLines:true,
	//selModel:checkBox,
	disableSelection:false,
	loadMask:true,
	columns:[
	         
	         {text:'学号',width:100,dataIndex:'studentId',sortable:true,
	        	 renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){
		        	 if(record.get('isHidden') == '1'){
		        		 return "匿名用户";
		        	 }
		        	 else{
		        		 return value;
		        	 }
		        	}},
	         {text:'姓名',width:100,dataIndex:'studentName',sortable:true,
	        	 renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){
	        	 if(record.get('isHidden') == '1'){
	        		 return "匿名用户";
	        	 }
	        	 else{
	        		 return value;
	        	 }
	         }},
	         {text:"分数",width:50,dataIndex:'inquireAnswer',sortable:true},
	         {text:"其他建议或期望",width:450,dataIndex:'other',sortable:true},
	         {text:"导师",width:150,dataIndex:'teacherId',sortable:true,hidden:true}
	         //{text:"备注",width:150,dataIndex:'remark',sortable:true}
	         ],
	autoHeight:true,
	authWidth:true,

	title:"问卷调查信息",
	loadMask:true,
});
var markgrid = Ext.create('Ext.grid.Panel',{
	store:markstore,	
	columnLines:true,
	disableSelection:false,
	loadMask:true,
	columns:[
	         new Ext.grid.RowNumberer(),
	         {text:'学年',width:200,dataIndex:'prom',sortable:true},
	         {text:'老师Id',width:200,dataIndex:'teacherId',sortable:true,hidden:true},
	         {text:'分数',width:200,dataIndex:'mark',sortable:true,renderer : function(mark){
	             if(mark == "0"){
	            	 return "暂无";
	             }
	             else{
	            	 return mark;
	             }
	         }},
	         { 
	        	 header: '查看详情', 
	        	 xtype: 'actioncolumn', 
	        	 width: 150,
	        	// style:'text-align:center',
	        	 items: ['->',
	        	         { 
	        	        	 iconCls: 'Zoom', 
	        	        	 tooltip: '查看详情',
	        	        	 handler: function (grid, rowIndex, colIndex) { 
	        	        		 var rec = grid.getStore().getAt(rowIndex);
	        	        		 var teacherId = rec.get('teacherId');
	        	        		 var prom = rec.get('prom');
	        	        		 //window.location.href="downloadFileAction.action?fileId="+fileId;
	        	        		 var editStudentInquireSourse = Ext.create('Ext.Window',{
	        	        				layout:'fit',
	        	        				width:800,
	        	        				height:600,
	        	        				closeAction:'hide',
	        	        				plain:true,
	        	        				resizable : false,
	        	        				title:'详细信息',
	        	        				items:inquireGrid,
	        	        				plain:true
	        	        				
	        	        			});
	        	  
	        	        		 editStudentInquireSourse.show();
	        	        		 inquireStore.proxy.extraParams.jsonString="{'teacherId':'"+teacherId+"','prom':'"+prom+"'}";
	        	        		 inquireStore.load();
	        	        	 }
	        	         }
	        	         ]
	         }
	         ],
	autoHeight:true,
	authWidth:true,

	title:"问卷调查结果",
	loadMask:true	
});
//questionstore.loadPage(1);

return markgrid;
};
